package com.ilancuo.init;

/**
 * 线程类的构造方法、静态块是被new这个线程类所在的线程所调用的，而run方法里面的代码才是被线程自身所调用的。
 *
 * Created by ilancuo on 2018/9/11.
 */
public class ThreadInit implements Runnable {

    static {
        System.out.println("static block: " + Thread.currentThread().getName());
    }

    public ThreadInit() {
        System.out.println("Constructor: " + Thread.currentThread().getName());
    }

    @Override
    public void run() {
        System.out.println("run: " + Thread.currentThread().getName());
    }

    public static void main(String[] args) {
        new Thread(new ThreadInit()).start();
    }
}
